// pages/MyScoreListPage/MyScoreListPage.js
var screenUtil = require("../../utils/screen.js");
var api = require("../../utils/request.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    arr:['','','','','','','','','','','','','','',''],
    leaderId:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    var that = this;
    that.data.leaderId = options.leaderId
    console.log('dddd=='+options.leaderId)
    var screen = screenUtil.screenUtil()
    var scrHeight = screen.windowHeight
    that.setData({
      navheight:getApp().globalData.zHeight*2,
      arr:that.data.arr,
      isTriggered:false,
      scrHeight:scrHeight
    })

    api.request1({"leaderId":that.data.leaderId,"path": "user/bonusList","token":wx.getStorageSync('token')}, function (result) {
      if(result.code=='0'){
        that.setData({
          scoreList:result.data,
          noData:false 
        })
      } else{
        that.setData({
          noData:true 
        })
      } 
    }, function (error) {
      console.log('error==')
    })
  },
  handleRefresher(event){
    // 发送请求获取最新的视频数据
    var that = this;

    api.request1({"leaderId":that.data.leaderId,"path": "user/bonusList","token":wx.getStorageSync('token')}, function (result) {
      if(result.code=='0'){
        that.setData({
          scoreList:result.data,
          isTriggered:false
        })
      }else{
        that.setData({
          scoreList:result.data,
          isTriggered:false
        })
      }  
    }, function (error) {
      console.log('error==')
    })
  },
  handlerGobackClick() {
    wx.navigateBack({
      delta: 1
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})